﻿using LibraryProject.Model;

namespace LibraryProject.Service;

public interface ILinkFileService {
    /// <summary>
    ///     Create LinkFile table
    /// </summary>
    /// <returns>
    ///     return -1: create fail, 0: table exist, 1: create success
    /// </returns>
    Task<int> CreateTable();

    /// <summary>
    ///     Insert one LinkFile
    /// </summary>
    /// <returns>1:success</returns>
    Task<int> InsertOne(LinkFile linkFile);

    /// <summary>
    ///     Insert all LinkFile
    /// </summary>
    Task InsertAll(List<LinkFile> linkFiles);

    /// <summary>
    ///     Query all LinkFiles
    /// </summary>
    Task<List<LinkFile>> QueryAll();

    /// <summary>
    ///     Init LinkFile table, include create table and insert data
    /// </summary>
    /// <returns></returns>
    Task<bool> InitDb();

    /// <summary>
    ///     Sort LinkFiles list to a tree struct
    /// </summary>
    Task<LinkFile> SortLinkFileList();

    // 删除表
    /// <summary>
    ///     Delete LinkFile table
    /// </summary>
    Task<int> DeleteTable();

    /// <summary>
    ///     Update name of LinkFile by id
    /// </summary>
    /// <remarks>
    /// <para><see cref="LinkFile"/> mainly include id and new name</para>
    /// </remarks>
    Task UpdateName(LinkFile linkFile);

    /// <summary>
    ///     Delete LinkFile by id
    /// </summary>
    Task DeleteById(int id);
}